import { time } from "@/utils/performance";
import { insertionSort as i, insertionSort2 as i2 } from "../insertionSort"
import { getSortedArr, isSorted, randomArr } from "../util"


export const test = () => {

    const arr = randomArr(0, 10000, 9990),
          arr2 = arr.slice();
    // p(arr)
    time('insertionSort', () => {
        i2(arr)
    })
    p(arr);

    time('insertionSort优化', () => {
        i(arr2)
    })
    p(arr2)
}

const p = (arr: number[]) => {
    console.log(isSorted(arr))
}